package cn.coisini.model.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author xiangshaw
 * Description: 菜单实体
 */
@Tag(name = "Menu",description = "菜单实体")
@Data
@TableName("tb_menu")
public class Menu implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "编号")
    private String id;

    @TableField("parent_id")
    @Schema(description = "所属上级")
    private String parentId;

    @TableField("name")
    @Schema(description = "名称")
    private String name;

    @TableField("type")
    @Schema(description = "类型（0目录 1菜单 2按钮）")
    private Integer type;

    @TableField("path")
    @Schema(description = "路由地址")
    private String path;

    @TableField("component")
    @Schema(description = "组件路径")
    private String component;

    @TableField("perms")
    @Schema(description = "权限标识")
    private String perms;

    @TableField("icon")
    @Schema(description = "图标")
    private String icon;

    @TableField("sort_value")
    @Schema(description = "排序")
    private Integer sortValue;

    @TableField("status")
    @Schema(description = "状态（0正常 1禁止）")
    private Boolean status;

    @TableField("create_time")
    @Schema(description = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING , pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;

    @TableField("update_time")
    @Schema(description = "更新时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING , pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime updateTime;

    @TableField("del_flag")
    @Schema(description = "删除标记（0可用 1已删除）")
    private Integer delFlag;

    @TableField(exist = false)
    private List<Menu> children;

    @TableField(exist = false)
    private boolean selected;
}
